<template>
  <el-card shadow="never" header="待处理报警信息" class="dashboard-todo-panel">
    <div v-for="(item, index) in warings" :key="index" class="wh-full py-3">
      <div class="flex-y-center">
        <LabelText text="待办" tag-type="danger" />
        <el-text
          size="small"
          class="w200px cursor-pointer !ml-2 !flex-1"
          truncated
          @click="handleTodoClick(item.id)"
        >
          {{ item.content }}
        </el-text>

        <div class="text-xs text-gray">
          {{ item.createTime }}
        </div>
      </div>
    </div>
  </el-card>
</template>

<script setup lang="ts">
import WaringAPI, { WaringModel } from "@/api/waring";
import LabelText from "@/components/label/label-text.vue";

const warings = ref<WaringModel[]>([]);

// 阅读通知公告
function handleTodoClick(id: number) {
  // noticeDetailRef.value.openNotice(id);
  // const index = notices.value.findIndex((notice) => notice.id === id);
  // if (index >= 0) {
  //   notices.value.splice(index, 1); // 从消息列表中移除已读消息
  // }
}

onMounted(() => {
  WaringAPI.getTodoWaringList().then((data: any) => {
    warings.value = data.list;
  });
});
</script>

<style lang="scss" scoped></style>
